<form class="layui-form " action="" lay-filter="dataForm">
    <input type="hidden" name="id">
    <div class="layui-form-item">
        <label class="layui-form-label">名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入名称" class="layui-input">
        </div>
    </div>  
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block">
            <input type="number" name="sort"  placeholder="请输入数字" class="layui-input">
        </div>
    </div>  
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="dataSubmit">确定</button>
        </div>
    </div>
</form>
<script>
    layui.use(['form', 'http', 'laydate'], function () {
        var form = layui.form;
        var http = layui.http;
        var $ = layui.$;
        var laydate = layui.laydate;
        laydate.render({
            elem: '#time',
            type: 'datetime'
        });

        //表单初始赋值
        form.val('dataForm', {
            "id": "{$id}",
            "name": "{$name}",
            "sort": "{$sort}",
        })
        //监听提交
        form.on('submit(dataSubmit)', function (data) {
            http.post('/product/productTypeEdit', data.field, function (res) {
                if (res.code == 0) {
                    parent.layui.table.reload('dataTable');
                    parent.layer.closeAll('page');
                }
            }, $(this))
            return false;
        })
    })
</script>